package org.qydjk.common.pojo.query;


import org.qydjk.common.pojo.Area;
import org.qydjk.common.pojo.Coupon;
import org.qydjk.common.pojo.ServeLabel;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * 商家实体
 *  Created by Edward_yang on 2017/12/14
 */
@Entity
@Table(name = "qy_seller", catalog = "qydjk")
public class QuerySeller {
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id; //ID 主键

	@Column(name = "name", length = 200)
	private String name;  //商家名称

	@Column(name = "thumbnail_img", length = 200)
	private String thumbnailImg;//商家缩略图

	@Column(name = "address", length = 100)
	private String address;//地址

	@Column(name = "business_hours", length = 100)
	private String businessHours;//营业时间，体检时间\

	@Column(name = "des", length = 65535)
	private String des; //机构简介

	@Column(name = "product_count")
	private Integer productCount;//产品数量

	@Column(name = "comment_score", precision = 2, scale = 1)
	private Float commentScore;//评分

	@Column(name = "initiate_price")
	private BigDecimal initiatePric;//起步价

	@Column(name = "ord")
	private Integer ord; //排序

	@Column(name = "verify_type")
	private Integer verifyType;//审核状态：0待审核1通过2拒绝

	@Column(name = "status")
	private Integer status; //状态：0禁用1正常

	@Column(name = "create_time", length = 19)
	private Date createTime; //创建时间

	@Column(name = "update_time", length = 19)
	private Date updateTime;//更新时间

	@Column(name = "label_codes", length = 200)
	private String labelCodes;//标签codes

	@ManyToMany(targetEntity = ServeLabel.class, fetch = FetchType.LAZY)
	@JoinTable(name = "qy_seller_serve_label", joinColumns = { @JoinColumn(name = "seller_id") }, inverseJoinColumns = { @JoinColumn(name = "serve_label_id") })
	// name中间表的名字,第一个自己的主键，第二个关联的主键 (服务标签)
	@OrderBy("ord desc")
	private List<ServeLabel> serveLabels = new ArrayList<ServeLabel>();

	@ManyToMany(targetEntity = Area.class, fetch = FetchType.LAZY)
	@JoinTable(name = "qy_seller_city", joinColumns = { @JoinColumn(name = "seller_id") }, inverseJoinColumns = { @JoinColumn(name = "area_id") })
	// name中间表的名字,第一个自己的主键，第二个关联的主键 (地址)
	@OrderBy("level desc")
	private List<Area> areas = new ArrayList<Area>();

	@OneToMany(targetEntity = Coupon.class,fetch = FetchType.LAZY)
	@JoinColumn(name = "seller_id")
	//商家优惠劵
	@OrderBy("update_time desc")
	private List<Coupon> coupons = new ArrayList<Coupon>();

	@Column(name = "lon")
	private Double lon;

	@Column(name = "lat")
	private Double lat;

	@Column(name = "two_area_id")
	private Integer twoAreaId;//城市ID


	@Column(name = "three_area_id")
	private Integer threeAreaId;//区ID

	@Column(name = "three_area_name", length = 100)
	private String threeAreaName;//区的name

	@Column(name = "virtual_collect_account")
	private Integer virtualCollectAccount;//虚拟收藏

	@Column(name = "collect_account")
	private Integer collectAccount; //收藏数量

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public List<ServeLabel> getServeLabels() {
		return serveLabels;
	}

	public void setServeLabels(List<ServeLabel> serveLabels) {
		this.serveLabels = serveLabels;
	}

	public List<Area> getAreas() {
		return areas;
	}

	public void setAreas(List<Area> areas) {
		this.areas = areas;
	}

	public List<Coupon> getCoupons() {
		return coupons;
	}

	public void setCoupons(List<Coupon> coupons) {
		this.coupons = coupons;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getThumbnailImg() {
		return thumbnailImg;
	}

	public void setThumbnailImg(String thumbnailImg) {
		this.thumbnailImg = thumbnailImg;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public BigDecimal getInitiatePric() {
		return initiatePric;
	}

	public void setInitiatePric(BigDecimal initiatePric) {
		this.initiatePric = initiatePric;
	}

	public Integer getProductCount() {
		return productCount;
	}

	public void setProductCount(Integer productCount) {
		this.productCount = productCount;
	}

	public Float getCommentScore() {
		return commentScore;
	}

	public void setCommentScore(Float commentScore) {
		this.commentScore = commentScore;
	}

	public String getBusinessHours() {
		return businessHours;
	}

	public void setBusinessHours(String businessHours) {
		this.businessHours = businessHours;
	}

	public Integer getOrd() {
		return ord;
	}

	public void setOrd(Integer ord) {
		this.ord = ord;
	}

	public Integer getVerifyType() {
		return verifyType;
	}

	public void setVerifyType(Integer verifyType) {
		this.verifyType = verifyType;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getLabelCodes() {
		return labelCodes;
	}

	public void setLabelCodes(String labelCodes) {
		this.labelCodes = labelCodes;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	public Double getLon() {
		return lon;
	}

	public void setLon(Double lon) {
		this.lon = lon;
	}

	public Double getLat() {
		return lat;
	}

	public void setLat(Double lat) {
		this.lat = lat;
	}

	public Integer getThreeAreaId() {
		return threeAreaId;
	}

	public void setThreeAreaId(Integer threeAreaId) {
		this.threeAreaId = threeAreaId;
	}

	public String getThreeAreaName() {
		return threeAreaName;
	}

	public void setThreeAreaName(String threeAreaName) {
		this.threeAreaName = threeAreaName;
	}

	public java.lang.Integer getVirtualCollectAccount() {
		return virtualCollectAccount;
	}

	public void setVirtualCollectAccount(java.lang.Integer virtualCollectAccount) {
		this.virtualCollectAccount = virtualCollectAccount;
	}

	public java.lang.Integer getCollectAccount() {
		return collectAccount;
	}

	public void setCollectAccount(java.lang.Integer collectAccount) {
		this.collectAccount = collectAccount;
	}

	public Integer getTwoAreaId() {
		return twoAreaId;
	}

	public void setTwoAreaId(Integer twoAreaId) {
		this.twoAreaId = twoAreaId;
	}
}